﻿<UserControl x:Class="FunctionPoint.FunctionPointExplorerToolWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0"             
    xmlns:converters="clr-namespace:FunctionPoint.Converters"
             xmlns:objects="clr-namespace:FunctionPoint.Objects"
             mc:Ignorable="d" 
             d:DesignHeight="354" d:DesignWidth="592" Loaded="UserControl_Loaded">
    <UserControl.Resources>

        <BitmapImage UriSource="/images/folder_open.png" x:Key="imgFolderOpen"></BitmapImage>
        <BitmapImage UriSource="/images/query.png" x:Key="imgQuery"></BitmapImage>
        <BitmapImage UriSource="/Images/workitem.png" x:Key="imgWorkItem"></BitmapImage>
        <BitmapImage UriSource="/Images/folder_close.png" x:Key="imgQueryFolder_Closed"></BitmapImage>
        <BitmapImage UriSource="/Images/folder_open.png" x:Key="imgQueryFolder_Open"></BitmapImage>
        <BitmapImage UriSource="/Images/folder_close_disabled.png" x:Key="imgQueryFolder_Closed_Disabled"></BitmapImage>
        <BitmapImage UriSource="/Images/folder_open_disabled.png" x:Key="imgQueryFolder_Open_Disabled"></BitmapImage>


        <converters:NestLevelToMarginConverter x:Key="nestLevelToMarginConverter" RightMargin="2" BottomMargin="1" TopMargin="2"/>


        <DataTemplate x:Key="templateWorkItemQueryFolder" DataType="objects:WorkItemQueryFolder" >
            <StackPanel Orientation="Horizontal" Margin="{Binding NestLevel, Converter={StaticResource nestLevelToMarginConverter}}">
                <Image Source="{StaticResource imgQueryFolder_Closed}"></Image>
                <TextBlock Text="{Binding Name}"></TextBlock>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="templateWorkItemQuery" >
            <StackPanel Orientation="Horizontal" Margin="{Binding NestLevel, Converter={StaticResource nestLevelToMarginConverter}}">
                <Image Source="{StaticResource imgQuery}"></Image>
                <TextBlock Text="{Binding Name}"></TextBlock>
            </StackPanel>
        </DataTemplate>

        <objects:WorkItemQueryComboBoxTemplateSelector x:Key="workItemQueryComboBoxTemplateSelector" 
                                                       WorkItemQueryFolderTemplate="{StaticResource templateWorkItemQueryFolder}"
                                                       WorkItemQueryTemplate="{StaticResource templateWorkItemQuery}"></objects:WorkItemQueryComboBoxTemplateSelector>

    </UserControl.Resources>
    <Grid x:Name="gridPrimary" AllowDrop="True">
        <Grid.Resources>
            <Style x:Key="styleHeaderText" TargetType="{x:Type TextBlock}">
                <Setter Property="FontSize" Value="14"  />
                <Setter Property="FontWeight" Value="Bold" />
            </Style>
            <Style  TargetType="{x:Type TabItem}">
                <Setter Property="FontSize" Value="12" />
                <Setter Property="FontWeight" Value="SemiBold" />
            </Style>

        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>

        </Grid.RowDefinitions>
        <Border BorderThickness="2" Background="{DynamicResource {x:Static SystemColors.ControlColor}}" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}">
            <Expander>
                <Expander.Header>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>

                        </Grid.ColumnDefinitions>
                        <TextBlock Style="{StaticResource styleHeaderText}">Query Options:</TextBlock>

                        <TextBlock HorizontalAlignment="Right" Grid.Column="1" Text="{Binding ElementName=cmbSelectedQuery, Path=Text}"></TextBlock>
                    </Grid>
                </Expander.Header>
                <Expander.Content>
                    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                        <Grid>
                            <Grid.Resources>
                                <Style x:Key="rightColumnStyle" TargetType="{x:Type TextBlock}">
                                    <Setter Property="Margin" Value="5,2,4,2"></Setter>
                                    <Setter Property="VerticalAlignment" Value="Center"></Setter>
                                </Style>
                                <Style TargetType="{x:Type ComboBox}">
                                    <Setter Property="Margin" Value="5,2,2,2"></Setter>
                                    <Setter Property="VerticalAlignment" Value="Center"></Setter>
                                </Style>
                            </Grid.Resources>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"></RowDefinition>
                                <RowDefinition Height="Auto"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" Grid.Row="0" Style="{StaticResource rightColumnStyle}">Selected Query:</TextBlock>
                            <ComboBox Grid.Column="1" Grid.Row="1" MaxWidth="350" MinWidth="300" HorizontalAlignment="Left" Margin="5,2,1,2" VerticalAlignment="Center" ></ComboBox>
                            <StackPanel Grid.Column="0" Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
                                <CheckBox Margin="5,2,4,2"></CheckBox>
                                <TextBlock>Limit Work Item Type:</TextBlock>
                            </StackPanel>

                            <ComboBox Grid.Column="1" Grid.Row="0" MaxWidth="350" MinWidth="300" HorizontalAlignment="Left" Margin="5,2,1,2" VerticalAlignment="Center" Name="cmbSelectedQuery" 
                                  ItemTemplateSelector="{StaticResource workItemQueryComboBoxTemplateSelector}" ItemsSource="{Binding QueryHierarchyFlat}" SelectionChanged="cmbSelectedQuery_SelectionChanged">
                            </ComboBox>

                        </Grid>
                    </ScrollViewer>
                </Expander.Content>
            </Expander>
                
                



        </Border>

        <!--<telerik:RadTreeListView Name="tlvWorkItemList" Grid.Row="1" SelectionMode="Multiple"  AutoGenerateColumns="False" AllowDrop="True"
                                 ItemsSource="{Binding ElementName=cmbSelectedQuery, Path=SelectedItem.WorkItems}" CanUserInsertRows="False" CanUserDeleteRows="False"
                                 RowIndicatorVisibility="Collapsed" GridLinesVisibility="None" Margin="0,2,0,0" SelectionChanged="tlvWorkItemList_SelectionChanged" IsDragDropEnabled="True">
            <telerik:RadTreeListView.Resources>

            </telerik:RadTreeListView.Resources>
            <telerik:RadTreeListView.ChildTableDefinitions>
                <telerik:TreeListViewTableDefinition ItemsSource="{Binding ChildWorkItems}" />
            </telerik:RadTreeListView.ChildTableDefinitions>
            <telerik:RadTreeListView.Columns>
                <telerik:GridViewSelectColumn Name="gvSelect"></telerik:GridViewSelectColumn>
                <telerik:GridViewComboBoxColumn Name="gvCmbAdormentColor" Header="Marker Color">

                </telerik:GridViewComboBoxColumn>
                <telerik:GridViewDataColumn Header="Type" DataMemberBinding="{Binding WorkItemType}" />
                <telerik:GridViewDataColumn Header="Title" DataMemberBinding="{Binding Title}" />
                <telerik:GridViewDataColumn Header="Engineer" DataMemberBinding="{Binding PrimaryEngineer}" />
                <telerik:GridViewDataColumn Header="Designer" DataMemberBinding="{Binding SolutionDesigner}" />
                <telerik:GridViewDataColumn Header="BSA" DataMemberBinding="{Binding BusinessSystemsAnalyst}" />
                <telerik:GridViewDataColumn Header="QA" DataMemberBinding="{Binding QualityAssuranceAnalyst}" />
                <telerik:GridViewDataColumn Header="UAT" DataMemberBinding="{Binding UATAnalyst}" />
            </telerik:RadTreeListView.Columns>
        </telerik:RadTreeListView>-->



        <!--<TabControl Grid.Row="1" Grid.ColumnSpan="3" HorizontalAlignment="Stretch"  Name="tabControl1" VerticalAlignment="Stretch" Margin="1,6,1,0" >
            <TabItem Header="Work Items" Name="tabItem1" >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="128*" />
                        <ColumnDefinition Width="452*" />
                    </Grid.ColumnDefinitions>
                </Grid>
            </TabItem>
            <TabItem Header="On This Page" Name="tabItemPages">
                <Grid></Grid>
            </TabItem>
        </TabControl>-->


    </Grid>

</UserControl>
